package run.bottle.app;

import cn.hutool.crypto.digest.BCrypt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import run.bottle.app.listener.NettyServer;
import run.bottle.app.model.entity.SysUser;
import run.bottle.app.service.UserService;

import java.net.InetSocketAddress;

@SpringBootApplication
public class AppApplication {

    @Autowired
    private UserService userService;

    public static void main(String[] args) {
        SpringApplication.run(AppApplication.class, args);
        NettyServer nettyServer = new NettyServer();
        nettyServer.start(new InetSocketAddress("127.0.0.1", 8091));
    }

    //@Bean
    public void InitUser() {
        SysUser user = new SysUser();
        user.setUsername("admin");
        user.setNickname("admin");
        user.setPassword(BCrypt.hashpw("123456", BCrypt.gensalt()));
        user.setAvatar("");
        user.setEmail("38707145@qq.com");
        //userService.removeAll();
        //userService.create(user);
        //System.out.println(user);
    }

}
